<?php

use yii\db\Migration;

class m180525_090612_create_customer_recharge extends Migration
{
    public function safeUp()
    {
        $tableOptions = null;
        if ($this->db->driverName === 'mysql') {
            $tableOptions = 'CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE=InnoDB';
        }
        $this->createTable('{{%customer_recharge}}', [
            'id' => $this->primaryKey(),
            'customer_id' => $this->integer(11)->defaultValue(0)->comment('会员id'),
            'total' => $this->decimal(10,2)->defaultValue(0)->comment('充值金额'),
            'operator' => $this->string(50)->defaultValue(null)->comment('操作人'),
            'operator_id' => $this->integer()->defaultValue(0)->comment('操作人id'),
            'cerated_at' => $this->integer()->defaultValue(0)->comment('充值时间'),
        ],$tableOptions);
    }

    public function safeDown()
    {
        $this->dropTable('{{%customer_recharge}}');
    }
}
